<template>
	<view>
		<u-navbar
			title="选择地址"
			rightText="管理"
			@rightClick="rightClick"
			:autoBack="true"
		>
		</u-navbar>
		<view class="searchBox">
			<view class="search">
				<view class="left" @click="toCity"> 
					<text>{{mycity}}</text>
					<image  src="/static/down.png" mode="heightFix"></image>
				</view>
				<view class="input">
					<input type="text" placeholder="搜索小区、酒店、大厦">
					<u-icon name="search" color="#1C274C" size="28"></u-icon>
				</view>
			</view>
		</view>
		<view class="cardBox">
			<view class="nowAddress">
				<view class="left">
					<view class="">当前地址</view>
					<view class="name hidden">{{myaddress}}</view>
				</view>
				<view class="right" @click="choose">
					<image src="/static/dingwei.png" mode=""></image>
					<view>重新定位</view>
				</view>
			</view>
			<view class="card" v-for="(item,index) in 2" :key="index">
				<view class="cbox">
					<view class="name">
						<image src="/static/address.png" mode="widthFix"></image>
						<view class="">龙翔嘉苑10号院</view>
					</view>
					<view class="address">
						河南省郑州市金水区龙湖外环路与龙源东六街
					</view>
				</view>
			</view>
			<view class="addAddress">
				<image src="/static/addAddress.png" mode="widthFix"></image>
				<view class="">添加常用地址</view>
			</view>
		</view>
		<view class="cardBox">
			<view class="title">附近地址</view>
			<view class="card" v-for="(item,index) in 3" :key="index">
				<view class="cbox">
					<view class="name">
						<image src="/static/address.png" mode="widthFix"></image>
						<view class="">龙翔嘉苑10号院</view>
					</view>
					<view class="address">
						河南省郑州市金水区龙湖外环路与龙源东六街
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				myaddress:'河南省郑州市金水区龙湖外环路与龙源东六街',
				mycity:'郑州市'
			};
		},
		onLoad() {
			
		},
		methods:{
			prevDateFun(object) {
				var _this = this
				if (object) {
					
					this.mycity = object.myctiy
				} else {
					return
				}
			},
			choose(){
				
				var that =this
				// #ifdef MP-WEIXIN || MP-QQ || MP-BAIDU
				uni.authorize({
					scope: 'scope.userLocation',
					success(res) {
						uni.chooseLocation({
							success: function(res) {														
								that.myaddress = res.address
								that.lat = res.latitude
								that.lng = res.longitude
							}
						});
					},
					fail(err) {
				
					}
				})
				// #endif
				uni.chooseLocation({
					success: function (res) {
						
						that.myaddress = res.address
					}
				});
			},
			rightClick() {
				
			},
			leftClick() {
				
			},
			toCity(){
				uni.navigateTo({
					url: '/pages/selectCity/selectCity'
				});
			}
		}
	}
</script>

<style lang="scss" scoped>
page{
	background: #F7F7FA;
}
.searchBox{
	background-color: #fff;
	width: 750rpx;
	padding: 100rpx 0 40rpx;
}
.search{
	width: 686rpx;
	height: 83rpx;
	border-radius: 42rpx;
	border: 3rpx solid #1C274C;
	display: flex;
	align-items: center;
	box-sizing: border-box;
	padding: 0 32rpx;
	margin: 0 auto ;
	background-color: #fff;
	.left{
		width: 130rpx;
		font-size: 12rpx;
		display: flex;
		align-items: center;
		border-right: 1rpx solid #000;
		image{
			width: 14rpx;
			height: 9rpx;
			margin-left: 15rpx;
		}
	}
	.input{
		width: 500rpx;
		display: flex;
		align-items: center;
		justify-content: space-between;
		input{
			margin-left:  30rpx;
		}
		.input-placeholder{
			font-size: 24rpx;
		}
	}
}
.cardBox{
	overflow: hidden;
	width: 686rpx;
	margin: 30rpx auto 0;
	background-color: #FFFFFF;
	.nowAddress{
		width: 686rpx;
		height: 155rpx;
		background: #00CE9B;
		border-radius: 20rpx;
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 0 32rpx;
		box-sizing: border-box;
		.left{
			line-height: 33rpx;
			font-size: 24rpx;
			color: #F7F7FA;
			.name{
				font-size: 28rpx;
				font-weight: 600;
				line-height: 39rpx;
				color: #FFFFFF;
			}
		}
		.right{
			width: 112rpx;
			height: 94rpx;
			background: #FFFFFF;
			border-radius: 20rpx;
			font-size: 20rpx;
			color: #00CE9B;
			line-height: 28rpx;
			display: flex;
			flex-direction: column;
			justify-content: center;
			align-items: center;
			image{
				width: 36rpx;
				height: 36rpx;
			}
		}
	}
	.card{
		width: 686rpx;
		height: 155rpx;
		display: flex;
		align-items: center;
		padding: 0 32rpx;
		box-sizing: border-box;
		border-bottom: 1rpx solid #EBEBEB;
		.cbox{
			
		}
		.name{
			display: flex;
			align-items: center;
			image{
				width: 25rpx;
				margin-right: 15rpx;
			}
			font-size: 26rpx;
			font-weight: 600;
			color: #1C274C;
			line-height: 39rpx;
		}
		.address{
			font-size: 24rpx;
			color: #ADB1BF;
			line-height: 34rpx;
			margin-left: 40rpx;
		}
	}
	.addAddress{
		display: flex;
		align-items: center;
		justify-content: center;
		font-size: 24rpx;
		color: #ADB1BF;
		padding: 30rpx 0;
		image{
			width: 28rpx;
			margin-right: 10rpx;
		}
	}
	.title{
		font-size: 30rpx;
		color: #333333;
		line-height: 42rpx;
		font-weight: 600;
		margin-left: 30rpx;
		margin-top: 40rpx;
	}
}
</style>
